跳到主要内容

FilePlugin

The plugin that can interact with the file list.

Interface: IFilePlugin.

Variables

fileItems

Stores a collection of elements where the keys are the key parameters from the FileItem objects. A list for hooking interactions with files is generated based on this collection.

Type: collection of IFileItem

Methods and their description

addFileItem

Add a new item for interactions with files.

Parameters:

NameTypeExampleDescription
fileItemsIFileItemDefines an item for interactions with files.

getFileItems

Get all the items for interactions with files.

updateFileItem

Update the item for interactions with files.

Parameters:

NameTypeExampleDescription
fileItemsIFileItemDefines a new item for interactions with files.

Example

import {type IFileItem, type IFilePlugin} from "@onlyoffice/docspace-plugin-sdk"

class Plugin implements IFilePlugin {
fileItems = new Map<string, IFileItem>()

addFileItem = (item: IFileItem): void => {
this.fileItems.set(item.extension, item)
}

getFileItems = (): Map<string, IFileItem> => {
return this.fileItems
}

updateFileItem = (item: IFileItem): void => {
this.fileItems.set(item.extension, item)
}
}